/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.annotations;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.Incubating;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;

/**
 * Specifies the mapped column for storing the time zone information,
 * for use in conjunction with {@link TimeZoneStorageType#COLUMN} or
 * {@link TimeZoneStorageType#AUTO}. The column is simply ignored if
 * {@code AUTO} is used and the database supports native time zone
 * storage.
 *
 * @author Christian Beikov
 * @author Steve Ebersole
 * @author Andrea Boriero
 * @see TimeZoneStorage
 * @see TimeZoneStorageType#COLUMN
 * @see TimeZoneStorageType#AUTO
 *
 * @since 6.0
 */
@Incubating
@Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD, METHOD })
public @interface TimeZoneColumn {

	/**
	 * (Optional) The name of the column. Defaults to
	 * the property or field name, suffixed by <code>_tz</code>.
	 */
	String name() default "";

	/**
	 * (Optional) Whether the column is included in SQL INSERT
	 * statements generated by the persistence provider.
	 */
	boolean insertable() default true;

	/**
	 * (Optional) Whether the column is included in SQL UPDATE
	 * statements generated by the persistence provider.
	 */
	boolean updatable() default true;

	/**
	 * (Optional) The SQL fragment that is used when
	 * generating the DDL for the column.
	 * <p> Defaults to the generated SQL to create a
	 * column of the inferred type.
	 */
	String columnDefinition() default "";

	/**
	 * (Optional) The name of the table that contains the column.
	 * If absent the column is assumed to be in the primary table.
	 */
	String table() default "";

	/**
	 * (Optional) The SQL fragment that is used when
	 * 	generating the DDL for the column.
	 * <p>
	 * The DDL must be written in the native SQL dialect
	 * of the target database (it is not portable across databases).
	 *
	 * @since 7.0
	 */
	String options() default "";

	/**
	 * (Optional) A comment to be applied to the column.
	 *
	 * @since 7.0
	 */
	String comment() default "";

}
